<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      let p = new Promise((resolve, reject) => {
        //改为成功
        resolve("OK");
      });
      
      //调用then方法
      // 由 then() 指定的回调函数执行的结果决定
      let result = p.then(v => {
        // console.log(v);
        //1. 返回非 promise 的数据
        // return 123;
        // return [1,2,3];
        //2. 返回 promise 的数据. 则返回值决定 then 的返回值
        // return new Promise((resolve, reject) => {
        //     // resolve('YES');
        //     // reject('No No No')
        // })
        //3. 抛出错误
        throw '出了点问题~~';

      });

      console.log(result);

    </script>
  </body>
</html>
